package dto

import (
	"vrcm/src/vrcm/app/admin/models/likes"
	"vrcm/src/vrcm/common/dto"
	common "vrcm/src/vrcm/common/models"
)

type LikesGetPageReq struct {
	dto.Pagination `search:"-"`
	LikesOrder
}

type LikesOrder struct {
	Id         string `form:"idOrder"  search:"type:order;column:id;table:likes"`
	TenantId   string `form:"tenant_idOrder"  search:"type:order;column:tenant_id;table:likes"`
	RoundId    string `form:"round_idOrder"  search:"type:order;column:round_id;table:likes"`
	LiveId     string `form:"live_idOrder"  search:"type:order;column:live_id;table:likes"`
	LikeNum    string `form:"like_numOrder"  search:"type:order;column:like_num;table:likes"`
	CreateBy   string `form:"createByOrder"  search:"type:order;column:create_by;table:likes"`
	UpdateBy   string `form:"updateByOrder"  search:"type:order;column:update_by;table:likes"`
	CreateTime string `form:"create_timeOrder"  search:"type:order;column:create_time;table:likes"`
	UpdateTime string `form:"update_imeOrder"  search:"type:order;column:update_time;table:likes"`
}

func (m *LikesGetPageReq) GetNeedSearch() interface{} {
	return *m
}

type LikesInsertReq struct {
	Id         int    `json:"-" comment:""` //
	TenantId   string `json:"tenant_id" comment:"租户"`
	RoundId    string `json:"round_id" comment:"场次id"`
	LiveId     int    `json:"live_id" comment:"直播间id"`
	LikeNum    int    `json:"like_num" comment:"点赞数"`
	CreateTime int64  `json:"create_time" comment:"创建时间"`
	UpdateTime int64  `json:"update_ime" comment:"更新时间"`
	common.ControlBy
}

func (s *LikesInsertReq) Generate(model *likes.Likes) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.TenantId = s.TenantId
	//model.RoundId = s.RoundId
	model.BindId = s.LiveId
	model.LikeNum = s.LikeNum
	model.CreateBy = s.CreateBy // 添加这而，需要记录是被谁创建的
	model.CreateTime = s.CreateTime
	model.UpdateTime = s.UpdateTime
}

func (s *LikesInsertReq) GetId() interface{} {
	return s.Id
}

type LikesUpdateReq struct {
	Id         int    `uri:"id" comment:""` //
	TenantId   string `json:"tenant_id" comment:"租户"`
	RoundId    string `json:"round_id" comment:"场次id"`
	LiveId     int    `json:"live_id" comment:"直播间id"`
	LikeNum    int    `json:"like_num" comment:"点赞数"`
	CreateTime int64  `json:"create_time" comment:"创建时间"`
	UpdateTime int64  `json:"update_ime" comment:"更新时间"`
	common.ControlBy
}

func (s *LikesUpdateReq) Generate(model *likes.Likes) {
	if s.Id == 0 {
		model.Model = common.Model{Id: s.Id}
	}
	model.TenantId = s.TenantId
	//model.RoundId = s.RoundId
	model.BindId = s.LiveId
	model.LikeNum = s.LikeNum
	model.UpdateBy = s.UpdateBy // 添加这而，需要记录是被谁更新的
	model.CreateTime = s.CreateTime
	model.UpdateTime = s.UpdateTime
}

func (s *LikesUpdateReq) GetId() interface{} {
	return s.Id
}

// LikesGetReq 功能获取请求参数
type LikesGetReq struct {
	Id int `uri:"id"`
}

func (s *LikesGetReq) GetId() interface{} {
	return s.Id
}

// LikesDeleteReq 功能删除请求参数
type LikesDeleteReq struct {
	Ids []int `json:"ids"`
}

func (s *LikesDeleteReq) GetId() interface{} {
	return s.Ids
}

type AddLikesNumReq struct {
	Id       int    `json:"id" comment:"点赞场次记录id" validate:"gt=0"`
	TenantId string `json:"tenant_id" comment:"租户"`
	RoundId  string `json:"round_id" comment:"场次id""`
	BindId   int    `json:"bind_id" comment:"活动id" validate:"gt=0"`
	LikeNum  int64  `json:"like_num" comment:"点赞数"`
	//common.ControlBy
}

type GetLikesNumReq struct {
	Id       int    `json:"id" comment:"点赞场次记录id"`
	TenantId string `json:"tenant_id" comment:"租户"`
	RoundId  string `json:"round_id" comment:"场次id"`
	BindId   int    `json:"bind_id" comment:"活动id"`
	//common.ControlBy
}
